from collections import defaultdict

n, m = map(int, input().split())
nums = list(map(int, input().split()))
prefix = [0]
for num in nums:
    prefix.append(prefix[-1] ^ num)
for _ in range(m):
    l,r = map(int, input().split())
    print(prefix[r]^prefix[l-1])
